Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/periph/rtc: Add rtc mem survive reset test #20404

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FlapKap
Copy link
Contributor

@FlapKap FlapKap commented Feb 21, 2024

Contribution description

The periph/rtc test did not test if the rtc memory persisted across reboot. This PR aims to fix that.
The test is reworked to utilize the shell module. This is needed since testing across reboots means we have to clear RTC memory first, then write and verify, then reboot and verify again. In addition the test still tests the rtc alarms.
Additionally this also changes the test to use ztimer instead of xtimer

Some parts of RIOT utilizes the backup registers in ways that will force a reset of the RTC and therefore of the registers. This test will fail on those since is clears and writes to all available registers. Ideas on how this should be handled is welcome!

Testing procedure

When running the test application execute the following commands and verify the output

  1. rtc_clear returns RTC mem cleared
  2. rtc_verify returns RTC mem content does not match
  3. rtc_write returns RTC mem set
  4. rtc_verify returns RTC mem OK
  5. rtc_reboot reboots device
  6. rtc_verify returns RTC mem OK
  7. rtc_clear returns RTC mem cleared. This is to clear RTC for the future.
  8. rtc_test_alarms returns
This test will display 'Alarm!' every 2 seconds for 4 times
Clock value is now   2024-02-20 15:41:43.176
  Setting clock to   2020-02-28 23:59:57
Clock value is now   2020-02-28 23:59:57.176
  Setting alarm to   2020-02-28 23:59:59
   Alarm is set to   2020-02-28 23:59:59
  Alarm cleared at   2020-02-28 23:59:57.176
       No alarm at   2020-02-28 23:59:59.176
  Setting alarm to   2020-02-28 23:59:61

Alarm!
Alarm!
Alarm!
Alarm!

This procedure is also included in the tests/01-run.py so make test on a board that supports the periph_rtc_mem feature will execute the above steps.

Issues/PRs references

@github-actions github-actions bot added Area: doc Area: Documentation Area: tests Area: tests and testing framework labels Feb 21, 2024
@kfessel
Copy link
Contributor

kfessel commented Mar 13, 2024

the commit will need rewording

<area of work>: <work done>

@FlapKap FlapKap force-pushed the add-rtc-mem-survive-reset-test branch from 06602ab to 4737760 Compare March 14, 2024 11:05
@FlapKap FlapKap requested a review from vincent-d as a code owner March 14, 2024 11:05
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels Mar 14, 2024
This commit rewrites the rtc test application to include
tests for rtc memory persistence across reboots
@FlapKap FlapKap force-pushed the add-rtc-mem-survive-reset-test branch from 4737760 to 24a1a95 Compare March 14, 2024 11:48
@github-actions github-actions bot removed Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels Mar 14, 2024
@FlapKap
Copy link
Contributor Author

FlapKap commented Mar 14, 2024

the commit will need rewording

<area of work>: <work done>

Should all be a-ok now

@FlapKap FlapKap requested a review from kfessel March 14, 2024 12:01
Comment on lines 169 to 170

_set_rtc_mem();
_get_rtc_mem();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions / static-tests

too many consecutive empty lines

@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 14, 2024
@riot-ci
Copy link

riot-ci commented Mar 14, 2024

Murdock results

✔️ PASSED

3b66723 Update tests/periph/rtc/main.c

Success Failures Total Runtime
19 0 20 30s

Artifacts

@kfessel kfessel added the CI: run tests If set, CI server will run tests on hardware for the labeled PR label Mar 14, 2024
@kfessel
Copy link
Contributor

kfessel commented Mar 14, 2024

seems like no rtc_mem-platform is in our CI-tests

@FlapKap
Copy link
Contributor Author

FlapKap commented Mar 19, 2024

seems like no rtc_mem-platform is in our CI-tests

the samr34 exists on iot-lab and should have rtc_mem. Also the lrwan1 board, however that uses backup registers and so this board will fail the test. (see #11304)

FlapKap and others added 2 commits March 19, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants